package com.ys.controller;

import com.ys.common.R;
import com.ys.pojo.TradeOrder;
import com.ys.pojo.TradeUser;
import com.ys.pojo.TradeUserMoneyLog;
import com.ys.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping("/findUserById")
    public R findUserById(@RequestBody TradeOrder order){
        TradeUser user = userService.findUserById(order);
        return R.ok().data("user",user);
    }

    @RequestMapping("/changeUserMoney")
    public R changeUserMoney(@RequestBody TradeUserMoneyLog userMoneyLog){
        Boolean aBoolean = userService.changeUserMoney(userMoneyLog);
        return R.ok().success(aBoolean);
    }

}
